import sys
from PyQt5.QtWidgets import *

class CommonHelper:
    def __init__(self):
        pass
    @staticmethod
    def readQss(style):
        with open(style,'r') as f:
            return f.read()


class MainWindow(QMainWindow):
    def __init__(self,parent=None):
        super(MainWindow,self).__init__(parent)
        self.resize(480,260)
        self.setWindowTitle('加载Qss')
        btn=QPushButton(self)
        btn.setText('添加')
        btn.setToolTip('测试提示')
        vbox=QVBoxLayout()
        vbox.addWidget(btn)
        btn.clicked.connect(self.openstyle)
        self.setLayout(vbox)

    def openstyle(self):
        styleFile = './style.qss'
        qssFile = CommonHelper.readQss(styleFile)
        self.setStyleSheet(qssFile)
if __name__ == '__main__':
    app=QApplication(sys.argv)
    win=MainWindow()

    win.show()
    sys.exit(app.exec_())